package com.example.demo.pipeline.handler.impl;

import com.example.demo.pipeline.context.TemplateContext;
import com.example.demo.pipeline.handler.TemplateHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author liyuncong
 * @version 1.0
 * @file ValidatedTemplateHandler
 * @brief ValidatedTemplateHandler
 * @details ValidatedTemplateHandler
 * @date 2022-11-02
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                        NAME               DESCRIPTION
 * 2022-11-02                  liyuncong          Created
 */
@Component
public class ValidatedTemplateHandler implements TemplateHandler<TemplateContext> {

    Logger log = LoggerFactory.getLogger(ValidatedTemplateHandler.class);

    @Override
    public Boolean handler(TemplateContext context) {
        log.info("valid template");

        if (null == context) {
            throw new RuntimeException("not allow empty");
        }
        return true;
    }
}
